package com.wpw.web.base;

/**
 * @Description:
 * @ClassName: RuntimeTest
 * @CreateDate: 2020-05-27 21:20
 * @author: wupengwei
 */
public class RuntimeTest {

    public static void main(String[] args) throws InterruptedException {

        Runnable r =  () -> System.out.println("dd");

        new Thread(r).start();

        Runtime.getRuntime().addShutdownHook(new Thread(){

            @Override
            public void run() {
                System.out.println("关闭了");
            }
        });

        while (true) {
            Thread.sleep(1000);
            System.out.println("ddd");
        }
    }
}